using System;
using System.Collections.Generic;
using ZoneFiveSoftware.Common.Data.Fitness;
using System.Drawing;

namespace FilteredStatistics.Common
{
    // This enum represents what the sortingOrder parameter can be in the CompareRanges
    //  method below
    public enum ColumnSortingType
    {
        Unsorted = 0,
        Ascending,
        Descending
    }

    // Implement all the functions in this interface and register that object in the
    //  IStatisticsProvider.RegisterProvider.  A proxy object will be created from
    //  the passed object in order to call the right functions using reflection
    public interface IStatisticsProvider
    {
        // Returns a list of GUIDs, one per stat column.  These IDs are then passed to
        //  the other functions below so you can handle them correctly
        IList<Guid> ColumnIds { get; }

        // Return the localized column header text for the given column
        String GetColumnHeader(Guid columnId, IActivity activity);

        // Return the column display color
        Color GetColumnColor(Guid columnId);

        // Return the text that is display for a given column in a single row.  The
        //  currentRange object parameter must be wrapped inside an object that uses
        //  reflection to replicate the IActivityRangeInfoCache interface.  Use the
        //  methods in that object to compute your statistics.
        String GetStatisticLabel(Guid columnId, object currentRange);

        // Return the text that is display for a given column in it's total row.  The
        //  allRanges list contains objects that must be wrapped inside an object that
        //  uses reflection to replicate the IActivityRangeInfoCache interface.  Use the
        //  methods in that object to compute your statistics.
        String GetTotalStatisticLabel(Guid columnId, IList<object> allRanges);

        // This function is used to sort the column stats in ascending or descending
        //  order (see above enum).  It follows the usual IComparer model for it's
        //  return value (above 0 for greater than, under 0 for less than, etc.).
        //  Make sure to invert your results depending on the sortingOrder parameter
        int CompareRanges(Guid columnId, int sortingOrder, object range1, object range2);
    }
}
